﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Windows.Forms.VisualStyles;
using System.Runtime.InteropServices;
using System.ComponentModel;

namespace ELab.Controls.flatstyle
{
    public class FlatTextbox : TextBox
    {
        public FlatTextbox()
        {
            base.BorderStyle = BorderStyle.FixedSingle;
        }

        private BorderDrawer borderDrawer = new BorderDrawer();
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            base.WndProc(ref m);
            if (this.BorderStyle != BorderStyle.None) borderDrawer.DrawBorder(ref m, this.Width, this.Height);
        }

        public Color BorderColor
        {
            get { return borderDrawer.BorderColor; }
            set
            {
                borderDrawer.BorderColor = value;
                Invalidate();
            }
        }
    }
}
